$(function(){
    WapSixData();
    Count();
    setInterval(function(){
        WapSixData();
        Count();
    },6000);
});

function WapSixData(){
    $.ajax({
        url:'../../public/index.php/admin/WapSixData',
        dataType:'json',
        success:function(data){
            if(data.code === 1){
                let html = `<span class="currency" style="height: 46px;line-height: 46px">实时交易对数据</span>`;
                for (let i=0;i<data.data.length;i++){
                    html += `<span class="currency">${data.data[i].name}/USDT<br>${data.data[i].close}</span>`
                }
                $('#c1').html(html);
            }else if(data.code === 0){
                lay(data.msg)
            }else{
                lay(data.msg);
                setTimeout(function(){
                    window.parent.close();
                    window.parent.location.href = '../index.html'
                },1500);
            }
        },
        error:function(){
            lay('网络错误');
        }
    });
}

function Count(){
    $.ajax({
        url:'../../public/index.php/admin/Count',
        dataType:'json',
        success:function(data){
            if(data.code === 1){
                $('#user').text(data.data.user);
                $('#vip').text(data.data.vip);
                $('#nx').text(data.data.nx);
                $('#cl').text(data.data.cl);
                $('#zn').text(data.data.zn);
            }else if(data.code === 0){
                lay(data.msg)
            }else{
                lay(data.msg);
                setTimeout(function(){
                    window.parent.close();
                    window.parent.location.href = '../index.html'
                },1500);
            }
        },
        error:function(){
            lay('网络错误');
        }
    });
}